#!/usr/bin/env python
# coding: utf-8

import sys

def main():
    for line in sys.stdin:
        genome_id, genes_vectors = line.strip('\n').split('\t')
        genes_vectors = [vec.split(':') for vec in genes_vectors.split(',')]
        print '%s\t%s' % (genome_id, ','.join(gene_id for (gene_id, length) in genes_vectors))

main()

